package benchmark.energy.tx;

import benchmark.transaction.definition.AbstractTransaction;

import java.util.List;
import java.util.Map;

public class ImportTemporalDataTx extends AbstractTransaction {
    public List<EnergyStatus> data;

    public ImportTemporalDataTx() {
    }
    // default constructor and getter setter are needed by json encode/decode.

    public ImportTemporalDataTx(List<EnergyStatus> lines) {
        this.setTxType(TxType.TX_IMPORT_TEMPORAL_DATA);
        this.data = lines;
        Metrics m = new Metrics();
        m.setReqSize(lines.size());
        this.setMetrics(m);
    }

    public List<EnergyStatus> getData() {
        return data;
    }

    public void setData(List<EnergyStatus> data) {
        this.data = data;
    }

    public static class MultiEntityEnergyStatus {
        private int timePoint;
        private Map<Integer, Float> status; // nodeid, value

        public Map<Integer, Float> getStatus() {
            return status;
        }

        public void setStatus(Map<Integer, Float> status) {
            this.status = status;
        }

        public int getTimePoint() {
            return timePoint;
        }

        public void setTimePoint(int timePoint) {
            this.timePoint = timePoint;
        }
    }

    public static class EnergyStatus {
        private int nodeId;
        private int timePoint;
        private List<Float> status; // nodeid, value

        public int getNodeId() {
            return nodeId;
        }

        public void setNodeId(int nodeId) {
            this.nodeId = nodeId;
        }

        public List<Float> getStatus() {
            return status;
        }

        public void setStatus(List<Float> status) {
            this.status = status;
        }

        public int getTimePoint() {
            return timePoint;
        }

        public void setTimePoint(int timePoint) {
            this.timePoint = timePoint;
        }
    }
}
